<template>
  <div class="header">
    <span class="left" v-show="leftShow" @click="close"><</span>
    <h2>{{title}}</h2>
    <span class="right">···</span>
  </div>
</template>

<script>
export default {
  // props:['leftShow']方法一
  //方法二
  props:{
    leftShow:{
      type:Boolean,
      // required:true,//必须传这个值
      default:true//默认值为true
    },
    title:{
      type:String,
      required:true,//必须传这个值
      default:true//默认值为true
    }
  },
  methods: {
    close(){
       this.$emit("close")
      // this.bus.$emit("close")
    }
  },
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
  .header{
    width:100%;
    height:40px;
    background:#ccc;
    position:relative;
    text-align:center;
    line-height:40px;
    font-size:16px;
  }
  .left{
    position:absolute;
    top:0;
    left:10px;
  }
  .right{
    position:absolute;
    top:0;
    right:10px;
  }
</style>
